//
//  SupportVC.swift
//  DianXia
//
//  Created by you&me on 2017/12/19.
//  Copyright © 2017年 you&me. All rights reserved.
//

import UIKit

class SupportVC: UIViewController {

    @IBOutlet weak var backBtn: UIButton!
    @IBOutlet weak var supportBtn: UIButton!
    var code = ""
    var taskNo = 0
    let supportVM = SupportVM()
    let dispose = DisposeBag()

    override func viewDidLoad() {
        super.viewDidLoad()
        supportVM.support(code, taskNo) // 申请补货
        
        supportVM.isRobotOpen.asDriver()
                 .drive(self.ex_robotState)
                 .disposed(by: dispose)
        supportBtn.rx.tap
                  .subscribe({ [weak self] _ in self?.supportVM.completeReplenishment((self?.code)!) })
                  .disposed(by: dispose)
        backBtn.rx.tap
            .subscribe({ _ in
                let vc = UIStoryboard.initialViewControllerFromStoryboard(.Home) as! UIViewController
                UIApplication.shared.keyWindow?.rootViewController = vc
            })
            .disposed(by: dispose)

    }


}
